working principle of a key